//
//  SuperDateUtil.swift
//  MyCloudMusic
//
//  Created by jin on 2024/8/18.
//

import Foundation

class SuperDateUtil{
    
    /// 获取当前年份
    static func currentYear() -> Int {
        // 当前日期
        let date = Date()
        
        let calendar = Calendar.current
        // 获取日期的元素 年
        let data = calendar.dateComponents([Calendar.Component.year], from: date)
        return data.year!
    }
    
    /// 获取当前天
    static func currentDay() -> Int {
        let date = Date()
        let calendar = Calendar.current
        let data = calendar.dateComponents([Calendar.Component.day], from: date)
        return data.day!
    }
    
    /// 将float秒（3.867312）格式化为：150:11
    static func second2MinuteSecond(_ data:Float) -> String {
        let minute = Int(data/60)
        let second = Int(data) % 60
        return String(format: "%02d:%02d",minute,second)
    }
}
